package com.codefish.framework.spring.beans.exception;

/**
 * 从资源加载BeanDefinition失败时抛出
 *
 * @author <a href='https://gitee.com/hzf2281'>codefish</a>
 * @version 1.0.0
 * @since 2022/10/01 下午 04:15
 */
public class BeanDefinitionStoreException extends BeansException {

    public BeanDefinitionStoreException(String resourceDescription, Throwable throwable) {
        super(String.format("解析资源'%s'异常：%s", resourceDescription, throwable.getMessage()));
    }

    public BeanDefinitionStoreException(String resourceDescription, String msg) {
        super(String.format("解析资源'%s'异常：%s", resourceDescription, msg));
    }

    public BeanDefinitionStoreException(String resourceDescription, String beanName, String msg) {
        super(String.format("名称为'%s'的BeanDefinition不合法，其定义于资源文件'%s':%s", beanName, resourceDescription, msg));
    }

    public BeanDefinitionStoreException(String resourceDescription, String beanName, Throwable throwable) {
        super(String.format("名称为'%s'的BeanDefinition不合法，其定义于资源文件'%s':%s", beanName, resourceDescription, throwable.getMessage()));
    }
}
